package cn.masterj.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author masterJ
 * @create 2020-04-03 10:25
 */
@Configuration
public class RestConfig {

    /**
     * 使用@LoadBalanced注解，赋予RestTemplate客户端负载均衡的能力
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
